home *** CD-ROM | disk | FTP | other *** search
- name switchta
- _TEXT segment byte public 'CODE'
- DGROUP group _DATA,_BSS
- assume cs:_TEXT,ds:DGROUP,ss:DGROUP
- _TEXT ends
- _DATA segment word public 'DATA'
- _d@ label byte
- _DATA ends
- _BSS segment word public 'BSS'
- _b@ label byte
- _BSS ends
- _TEXT segment byte public 'CODE'
- ; Line 19
- _switchta proc near
- ; Line 20
- ; Line 21
- mov ax,word ptr DGROUP:_taskind
- mov dx,20
- mul dx
- mov bx,ax
- pushf
- pop ax; get flags
- mov word ptr DGROUP:_jpr[bx],sp
- mov word ptr DGROUP:_jpr[bx+2],ss
- mov word ptr DGROUP:_jpr[bx+4],ax ;save flags
- mov word ptr DGROUP:_jpr[bx+10],bp
- mov word ptr DGROUP:_jpr[bx+12],di
- mov word ptr DGROUP:_jpr[bx+14],es
- mov word ptr DGROUP:_jpr[bx+16],si
-
- ;save window
- call near ptr _wherey
- mov bx,word ptr DGROUP:_taskind
- shl bx,1
- shl bx,1
- shl bx,1
- mov byte ptr DGROUP:_windows[bx+4],al ;save cursor y
- call near ptr _wherex
- mov bx,word ptr DGROUP:_taskind
- shl bx,1
- shl bx,1
- shl bx,1
- mov byte ptr DGROUP:_windows[bx+5],al ;save cursor x
-
- mov al, byte ptr DGROUP:__video+4; get task attr
- mov byte ptr DGROUP:_windows[bx+6],al; save task attr
-
- inc word ptr DGROUP:_taskind; get next task
-
- mov ax, word ptr DGROUP:_taskind
- cmp ax, word ptr DGROUP:_maxtask
- jle @2
- mov word ptr DGROUP:_taskind,0000; loop to task 0
-
- @2:
- mov ax,word ptr DGROUP:_taskind
- mov dx,20
- mul dx
- mov bx,ax
- cli ; no interrupts during stack switching
- mov sp,word ptr DGROUP:_jpr[bx]; restore SP
- mov ss,word ptr DGROUP:_jpr[bx+2]; restore SS
- mov bp,word ptr DGROUP:_jpr[bx+10]; restore bp
- mov di,word ptr DGROUP:_jpr[bx+12]; restore di
- mov es,word ptr DGROUP:_jpr[bx+14]; restore es
- mov si,word ptr DGROUP:_jpr[bx+16]; restore si
- sti ;interrupts on again
-
- @1:
-
- ;get next window
- push bx
- mov bx,word ptr DGROUP:_taskind;
- shl bx,1
- shl bx,1
- shl bx,1
- mov al, byte ptr DGROUP:_windows[bx];
- mov byte ptr DGROUP:__video,al;
- mov al, byte ptr DGROUP:_windows[bx+1];
- mov byte ptr DGROUP:__video+1,al;
- mov al, byte ptr DGROUP:_windows[bx+2];
- mov byte ptr DGROUP:__video+2,al;
- mov al, byte ptr DGROUP:_windows[bx+3];
- mov byte ptr DGROUP:__video+3,al;
-
- mov al, byte ptr DGROUP:_windows[bx+6];
- mov byte ptr DGROUP:__video+4,al; restore task attribute
-
- mov al, byte ptr DGROUP:_windows[bx+4];
- cbw
- push ax
- mov bx,word ptr DGROUP:_taskind;
- shl bx,1
- shl bx,1
- shl bx,1
- mov al,byte ptr DGROUP:_windows[bx+5]
- cbw
- push ax
- call near ptr _gotoxy
- pop cx
- pop cx
- pop bx
-
-
- ret
- _switchta endp
- _TEXT ends
- _BSS segment word public 'BSS'
- _BSS ends
- _DATA segment word public 'DATA'
- extrn _taskind:WORD, _jpr:WORD,_maxtask:WORD,_windows:WORD
- extrn __video:WORD
- _s@ label byte
- _DATA ends
- _TEXT segment byte public 'CODE'
- public _switchta
- extrn _wherey:near
- extrn _wherex:near
- extrn _gotoxy:near
- _TEXT ends
- end